﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using DevCow.Mashups.Blocks.Samples.DevCowProxy;


namespace DevCow.Mashups.Blocks.Samples
{
    class DevCowBlocks
    {
        public DataSet GetNextEvent(string userGroupName, int regionId)
        {
            UGEventService service = new UGEventService();
            DataSet ds = service.GetNextEvent(userGroupName, regionId);
            return ds;
        }

        public DevCowEvent GetNextEvent2(string userGroupName, int regionId)
        {
            UGEventService service = new UGEventService();
            DataSet ds = service.GetNextEvent(userGroupName, regionId);
            return new DevCowEvent(ds.Tables[0].Rows[0]);
        }

        internal class DevCowEvent
        {
            public DevCowEvent()
            {}
            public DevCowEvent(DataRow dr)
            {
                this.UserGroup = dr["UserGroup"].ToString();
                this.Location = dr["LocationName"].ToString();
                this.Details = dr["Details"].ToString();
            }
            public string UserGroup { get; set; }
            public string Location { get; set; }
            public string Details { get; set; }
            public DateTime Start { get; set; }
            public DateTime End { get; set; }

            public override string ToString()
            {
                return String.Format("UG={0},Location={1},Details={2},Start={3},End={4}", this.UserGroup, this.Location,
                                     this.Details, this.Start, this.End);
            }
        }
    }
}
